Skip to content

Conversation

@JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Oct 2, 2024

This reverts commit ed0cd4a.

See #17864 for context. The implementation has some issues, and I'm reverting the PR to unblock the 1.12 release.

Closes #17864. Closes #17841.

This reverts commit ed0cd4a.

See #17864 for context. The implementation has some issues, and I'm
reverting the PR to unblock the 1.12 release.
@JukkaL JukkaL merged commit 329e38e into master Oct 2, 2024
19 checks passed
@JukkaL JukkaL deleted the revert-in-narrow branch October 2, 2024 14:44
@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2024

Diff from mypy_primer, showing the effect of this PR on open source code:

pycryptodome (https://github.com/Legrandin/pycryptodome)
- lib/Crypto/SelfTest/Signature/test_dss.py:334: error: Incompatible types in assignment (expression has type "None", variable has type "str")  [assignment]

pydantic (https://github.com/pydantic/pydantic)
- pydantic/v1/generics.py:124: error: No overload variant of "create_model" matches argument types "str", "str", "tuple[Any, ...]", "None", "dict[str, classmethod[Any, Any, Any]]", "None", "dict[str, tuple[DeferredType, FieldInfo]]"  [call-overload]
+ pydantic/v1/generics.py:124: error: No overload variant of "create_model" matches argument types "str", "str", "tuple[Any, ...]", "None", "dict[str, classmethod[Any, Any, Any]]", "None", "dict[Any, tuple[DeferredType, FieldInfo]]"  [call-overload]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/context/menu.py:141: error: Incompatible return value type (got "CommandType", expected "Literal[CommandType.USER, CommandType.MESSAGE]")  [return-value]
- tanjun/commands/menu.py:534: error: Incompatible types in assignment (expression has type "CommandType", variable has type "Literal[CommandType.USER]")  [assignment]
- tanjun/commands/menu.py:534: error: Incompatible types in assignment (expression has type "CommandType", variable has type "Literal[CommandType.MESSAGE]")  [assignment]

psycopg (https://github.com/psycopg/psycopg)
- tests/types/test_array.py:212: error: Incompatible types in assignment (expression has type "type[int] | type[float]", variable has type "type[Decimal]")  [assignment]

pandas (https://github.com/pandas-dev/pandas)
- pandas/core/arrays/string_.py:178: error: Redundant cast to "str"  [redundant-cast]
- pandas/io/stata.py:1508: error: Redundant cast to "str"  [redundant-cast]
- pandas/io/stata.py:1837: error: Redundant cast to "str"  [redundant-cast]
- pandas/io/stata.py:1843: error: Redundant cast to "str"  [redundant-cast]
- pandas/core/internals/concat.py:98: error: Argument 2 to "_is_homogeneous_mgr" has incompatible type "type[object]"; expected "dtype[Any] | ExtensionDtype"  [arg-type]
- pandas/core/internals/concat.py:104: error: Argument 3 to "_concat_homogeneous_fastpath" has incompatible type "type[object]"; expected "dtype[Any]"  [arg-type]
- pandas/tests/extension/test_masked.py:309: error: "str" has no attribute "name"  [attr-defined]

operator (https://github.com/canonical/operator)
- ops/lib/__init__.py:241: error: Argument 1 to "_Missing" has incompatible type "dict[str, object]"; expected "bool"  [arg-type]
+ ops/lib/__init__.py:241: error: Argument 1 to "_Missing" has incompatible type "dict[str | Any, object]"; expected "bool"  [arg-type]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/collections.py:391: error: "Never" not callable  [misc]
+ src/prefect/server/api/server.py:498: error: Invalid index type "tuple[str, bool]" for "dict[tuple[Settings, bool], Any]"; expected type "tuple[Settings, bool]"  [index]

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply" of class "DefaultSubstitutions":
- sphinx/transforms/__init__.py:121:68: error: Argument 1 to "_handle_default_substitution" of "DefaultSubstitutions" has incompatible type "str"; expected "Literal['version', 'release', 'today', 'translation progress']"  [arg-type]

streamlit (https://github.com/streamlit/streamlit)
- lib/streamlit/elements/heading.py: note: In member "_handle_divider_color" of class "HeadingMixin":
- lib/streamlit/elements/heading.py:249:20: error: Redundant cast to "str"  [redundant-cast]

spark (https://github.com/apache/spark)
- python/pyspark/pandas/utils.py:746: error: Redundant cast to "int"  [redundant-cast]

colour (https://github.com/colour-science/colour)
- colour/io/image.py:670: error: Value of type variable "_IntType" of "iinfo" cannot be "object"  [type-var]
- colour/io/image.py:671: error: Value of type variable "_IntType" of "iinfo" cannot be "object"  [type-var]
- colour/io/image.py:675: error: Argument 2 to "as_int_array" has incompatible type "type[object]"; expected "type[signedinteger[_8Bit]] | type[signedinteger[_16Bit]] | type[signedinteger[_32Bit]] | type[signedinteger[_64Bit]] | type[unsignedinteger[_8Bit]] | type[unsignedinteger[_16Bit]] | type[unsignedinteger[_32Bit]] | type[unsignedinteger[_64Bit]] | None"  [arg-type]

pytest (https://github.com/pytest-dev/pytest)
- src/_pytest/python_api.py:322: error: "Never" not callable  [misc]

schema_salad (https://github.com/common-workflow-language/schema_salad)
- schema_salad/avro/schema.py: note: In function "make_avsc_object":
- schema_salad/avro/schema.py:703:30: error: Redundant cast to "str"  [redundant-cast]
- schema_salad/schema.py: note: In function "make_valid_avro":
- schema_salad/schema.py:561:28: error: Redundant cast to "str"  [redundant-cast]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- pymongo/common.py:378: error: Incompatible return value type (got "str", expected "_ServerMode")  [return-value]

aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/rtcpeerconnection.py:1143: error: Invalid index type "int | str" for "dict[int, RTCRtpDecodingParameters]"; expected type "int"  [index]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/ext/csgo/state.py:210: error: Argument 1 to "__delitem__" of "dict" has incompatible type "int"; expected "AssetID"  [arg-type]
+ steam/ext/csgo/state.py:211: error: Argument 1 to "__delitem__" of "dict" has incompatible type "int"; expected "AssetID"  [arg-type]

discord.py (https://github.com/Rapptz/discord.py)
- discord/gateway.py:968: error: Argument 3 to "select_protocol" of "DiscordVoiceWebSocket" has incompatible type "Literal['xsalsa20_poly1305_lite', 'xsalsa20_poly1305_suffix', 'xsalsa20_poly1305']"; expected "int"  [arg-type]
- discord/state.py:656: error: Unused "type: ignore" comment  [unused-ignore]

jax (https://github.com/google/jax)
- jax/_src/interpreters/partial_eval.py:2587: error: Unused "type: ignore" comment  [unused-ignore]

ibis (https://github.com/ibis-project/ibis)
- ibis/common/graph.py:156: error: "Never" not callable  [misc]

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- mitmproxy/addons/core.py:172: error: Unused "type: ignore" comment  [unused-ignore]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Narrowing inconsistency between == and "in" Wrong type inferred when "not in" narrowing Any

2 participants